# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models

class Migration(SchemaMigration):

    def forwards(self, orm):
        
        # Adding model 'Ingredient'
        db.create_table('brewing_ingredient', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('amount', self.gf('django.db.models.fields.FloatField')()),
            ('units', self.gf('django.db.models.fields.CharField')(max_length=10)),
            ('add_time', self.gf('django.db.models.fields.CharField')(max_length=500)),
            ('substance', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['brewing.Substance'])),
        ))
        db.send_create_signal('brewing', ['Ingredient'])

        # Adding model 'Recipe'
        db.create_table('brewing_recipe', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
        ))
        db.send_create_signal('brewing', ['Recipe'])

        # Adding M2M table for field ingredient on 'Recipe'
        db.create_table('brewing_recipe_ingredient', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('recipe', models.ForeignKey(orm['brewing.recipe'], null=False)),
            ('ingredient', models.ForeignKey(orm['brewing.ingredient'], null=False))
        ))
        db.create_unique('brewing_recipe_ingredient', ['recipe_id', 'ingredient_id'])

        # Adding model 'Substance'
        db.create_table('brewing_substance', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=500)),
            ('alpha_acid_percent', self.gf('django.db.models.fields.FloatField')(null=True, blank=True)),
        ))
        db.send_create_signal('brewing', ['Substance'])

        # Adding model 'Brew'
        db.create_table('brewing_brew', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('recipe', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['brewing.Recipe'])),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=500)),
        ))
        db.send_create_signal('brewing', ['Brew'])

        # Adding model 'Container'
        db.create_table('brewing_container', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('purchased_on', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
            ('description', self.gf('django.db.models.fields.CharField')(max_length=100)),
            ('capacity', self.gf('django.db.models.fields.FloatField')(null=True, blank=True)),
        ))
        db.send_create_signal('brewing', ['Container'])

        # Adding model 'Action'
        db.create_table('brewing_action', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('action', self.gf('django.db.models.fields.CharField')(max_length=100)),
            ('fermenter', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['brewing.Container'])),
            ('gravity', self.gf('django.db.models.fields.FloatField')(null=True, blank=True)),
            ('when', self.gf('django.db.models.fields.DateTimeField')()),
            ('comments', self.gf('django.db.models.fields.TextField')()),
        ))
        db.send_create_signal('brewing', ['Action'])


    def backwards(self, orm):
        
        # Deleting model 'Ingredient'
        db.delete_table('brewing_ingredient')

        # Deleting model 'Recipe'
        db.delete_table('brewing_recipe')

        # Removing M2M table for field ingredient on 'Recipe'
        db.delete_table('brewing_recipe_ingredient')

        # Deleting model 'Substance'
        db.delete_table('brewing_substance')

        # Deleting model 'Brew'
        db.delete_table('brewing_brew')

        # Deleting model 'Container'
        db.delete_table('brewing_container')

        # Deleting model 'Action'
        db.delete_table('brewing_action')


    models = {
        'brewing.action': {
            'Meta': {'object_name': 'Action'},
            'action': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'comments': ('django.db.models.fields.TextField', [], {}),
            'fermenter': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['brewing.Container']"}),
            'gravity': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'when': ('django.db.models.fields.DateTimeField', [], {})
        },
        'brewing.brew': {
            'Meta': {'object_name': 'Brew'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '500'}),
            'recipe': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['brewing.Recipe']"})
        },
        'brewing.container': {
            'Meta': {'object_name': 'Container'},
            'capacity': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
            'description': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'purchased_on': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'})
        },
        'brewing.ingredient': {
            'Meta': {'object_name': 'Ingredient'},
            'add_time': ('django.db.models.fields.CharField', [], {'max_length': '500'}),
            'amount': ('django.db.models.fields.FloatField', [], {}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'substance': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['brewing.Substance']"}),
            'units': ('django.db.models.fields.CharField', [], {'max_length': '10'})
        },
        'brewing.recipe': {
            'Meta': {'object_name': 'Recipe'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'ingredient': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['brewing.Ingredient']", 'symmetrical': 'False'})
        },
        'brewing.substance': {
            'Meta': {'object_name': 'Substance'},
            'alpha_acid_percent': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '500'})
        }
    }

    complete_apps = ['brewing']
